﻿using BloggerAutoPosterService.Engine.Models;
using BloggerAutoPoster.Common.Mvvm;

namespace BloggerAutoPoster.Infrastructure.Models
{
    public class PostsListGui : ViewModelBase
    {
        #region Fields (7)

        bool _isBusy;
        bool _isEnabled = true;
        NewsItems _newsItemsList = new NewsItems();
        bool _popupDoCfgIsOpen;
        string _saveFilePath;
        int _scrollToIndex;
        string _searchText;
        NewsRecord _selectedItem;

        #endregion Fields

        #region Properties (7)

        public bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                if (_isBusy == value) return;
                _isBusy = value;
                RaisePropertyChanged("IsBusy");
            }
        }

        public bool IsEnabled
        {
            get { return _isEnabled; }
            set
            {
                if (_isEnabled == value) return;
                _isEnabled = value;
                RaisePropertyChanged("IsEnabled");
            }
        }

        public NewsItems NewsItemsList
        {
            set
            {
                if (_newsItemsList == value) return;
                _newsItemsList = value;
                RaisePropertyChanged("NewsItemsList");
            }
            get { return _newsItemsList; }
        }

        public bool PopupDoCfgIsOpen
        {
            get { return _popupDoCfgIsOpen; }
            set
            {
                _popupDoCfgIsOpen = value;
                RaisePropertyChanged("PopupDoCfgIsOpen");
            }
        }

        public string SaveFilePath
        {
            get { return _saveFilePath; }
            set
            {
                if (_saveFilePath == value) return;
                _saveFilePath = value;
                RaisePropertyChanged("SaveFilePath");
            }
        }
        
        public int ScrollToIndex
        {
            get { return _scrollToIndex; }
            set
            {
                _scrollToIndex = value;
                RaisePropertyChanged("ScrollToIndex");
            }
        }

        public string SearchText
        {
            get { return _searchText; }
            set
            {
                if (_searchText == value) return;
                _searchText = value;
                RaisePropertyChanged("SearchText");
            }
        }

        public NewsRecord SelectedItem
        {
            get { return _selectedItem; }
            set
            {
                if (_selectedItem == value) return;
                _selectedItem = value;
                RaisePropertyChanged("SelectedItem");
            }
        }

        #endregion Properties
    }
}
